(function () {
    angular.module('DIBS').config(configRoute);
    angular.module('DIBS').factory('Page', function () {
        var title = 'DIBS';
        return {
            title: function () {
                return title
            },
            setTitle: function (newTitle) {
                title = newTitle;
                return title;
            }
        };
    });
    angular.module('DIBS')
        .controller('mainController', mainController);
    mainController.$inject =
        [
            '$scope',
            'Page'
        ];

    function mainController($scope, Page) {
        $scope.Page = Page;
    }

    configRoute.$inject =
        ['$routeProvider'];

    function configRoute($routeProvider) {
        console.log(1);
        $routeProvider
        // home page
            .when('/', {
                templateUrl: 'views/searchServiceInfo.html',
                controller: 'searchServiceInfoCtrl',
                controllerAs: 'vm'
            })
            .when('/addUser', {
                templateUrl: 'views/addUser.html',
                controller: 'addUserCtrl',
                controllerAs: 'vm'
            })
            .when('/addServiceInfo', {
                templateUrl: 'views/addServiceInfo.html',
                controller: 'addServiceInfoCtrl',
                controllerAs: 'vm'
            })
            .when('/searchServiceInfo', {
                templateUrl: 'views/searchServiceInfo.html',
                controller: 'searchServiceInfoCtrl',
                controllerAs: 'vm'
            })
        ;

    }
})();
